<?php

use think\migration\Seeder;

class Articles extends Seeder
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * http://docs.phinx.org/en/latest/seeding.html
     */
    public function run()
    {
        $this->insert('articles', $this->articlesData());
    }

    public function articlesData()
    {

        $faker = \Faker\Factory::create('zh_CN');

        $arr = [];
        for ($i = 0; $i < 10; $i++) {
            $arr[] = [
                'title' => $faker->sentence,
                'description' => $faker->word,
                'thumbnail' => $faker->imageUrl(),
                'content' => $faker->text(),
                'keywords' => $faker->company,
                'create_time' => $faker->date('Y-m-d H:i:s'),
                'update_time' => $faker->date('Y-m-d H:i:s')
            ];
        }

        return $arr;

    }

}